Skip to main content
Version: 12.10.0

Troubleshooting Common Errors in FE

1. Introduction

This document serves as a guide to troubleshoot common errors encountered in mobile applications on both iOS and Android platforms. It provides solutions to typical issues developers might face, along with best practices to ensure smooth development and deployment processes.

2. General Troubleshooting Steps

  • Check Logs: Always start by checking the logs. iOS uses Xcode logs, while Android uses Logcat in Android Studio.
  • Clean and Rebuild: Often, cleaning the project and rebuilding it can resolve many issues.
  • Dependency Management: Ensure all dependencies are properly installed and up to date.
  • Check for Updates: Make sure that your development tools (Xcode, Android Studio) and SDKs are updated.
  • Restart IDE/Computer: Sometimes, a simple restart of your development environment or computer can resolve unexpected issues.
  • Google the Error: Often, errors are not unique, and a quick search can lead to solutions from the developer community.

3. Common iOS Errors and Solutions

Build Errors

1. Code Signing Error:

  • Solution: Ensure that the correct provisioning profile and certificate are selected in the project settings. Verify that the Apple Developer account is correctly configured.

2. Undefined Symbols for Architecture:

  • Solution: Check that all required frameworks and libraries are linked correctly in the Build Phases. Ensure that the target architectures are properly set in the project settings.

3. Module Not Found:

  • Solution: Make sure that the module is added to the project and is correctly referenced in the import statement. Clean and rebuild the project.

Runtime Errors

1. EXC_BAD_ACCESS:

  • Solution: This is often due to accessing a deallocated object. Use Instruments to track down memory issues and ensure proper memory management.

2. Unrecognized Selector Sent to Instance:

  • Solution: Verify that the method being called exists and is correctly defined. Check for typos and ensure that the object is of the correct type.

3. JSON Parsing Error:

  • Solution: Validate the JSON response using online tools or debuggers. Ensure that the model classes match the JSON structure.

UI Issues

1. UI Elements Not Responding to Touch:

  • Solution: Check the view hierarchy to ensure that the elements are not obscured by other views. Verify that user interaction is enabled.

2. UI Layout Issues:

  • Solution: Since SwiftUI is used, ensure that the view modifiers and layout containers are correctly applied. Use the Xcode Preview to test the layout across different devices and orientations.

4. Common Android Errors and Solutions

Build Errors

1. Gradle Sync Failed:

  • Solution: Ensure that the Gradle files are correctly configured. Check for network issues and proxy settings if downloading dependencies fails.

2. Cannot Resolve Symbol:

  • Solution: Verify that the dependency is correctly added to the build.gradle file. Sync the project with Gradle files.

3. Manifest Merger Failed:

  • Solution: Check for conflicts in the AndroidManifest.xml files of dependencies. Resolve any attribute conflicts and ensure proper merging.

Runtime Errors

1. NullPointerException:

  • Solution: Ensure that objects are properly initialized before use. Add null checks where necessary and use tools like Android Studio's debugger to trace the issue.

2. ActivityNotFoundException:

  • Solution: Verify that the activity is declared in the AndroidManifest.xml. Check for typos in the intent filters and the activity class name.

3. NetworkOnMainThreadException:

  • Solution: Ensure that all network operations are performed on a background thread using AsyncTask, RxJava, or Kotlin Coroutines.

UI Issues

1. UI Not Updating:

  • Solution: Ensure that UI updates are performed on the main thread. Use tools like LiveData, ViewModel, or runOnUiThread to handle UI updates.

2. Layout Issues on Different Screen Sizes:

  • Solution: Use constraint layouts and ensure that views are responsive to different screen sizes. Test on multiple devices and use the layout inspector tool.

5. Production App Error Troubleshooting

iOS Production Issues

1. Crashes:

  • Solution: Normally, we can use crash analytics to gather crash reports, analyze the stack trace to identify the cause, and roll out hotfixes or patches as needed. However, in our project, we are not using crash analytics.

2. Performance Issues:

  • Solution: Use Instruments to profile the app and identify performance bottlenecks. Optimize code and reduce memory usage.

3. Network Issues:

  • Solution: Ensure that the app handles network errors gracefully. Implement retry logic and use tools like Charles Proxy to debug network requests.

4. App Store Rejections:

  • Solution: Carefully review the App Store guidelines and ensure compliance. Address any feedback from the review team and resubmit the app.

Android Production Issues

1. Crashes:

  • Solution: Normally, we can use crash analytics to gather crash reports, analyze the stack trace to identify the cause, and roll out hotfixes or patches as needed. However, in our project, we are not using crash analytics.

2. Performance Issues:

  • Solution: Use Android Profiler to identify performance bottlenecks. Optimize code and reduce memory usage.

3. Network Issues:

  • Solution: Ensure that the app handles network errors gracefully. Implement retry logic and use tools like Stetho or Charles Proxy to debug network requests.

4. Google Play Store Rejections:

  • Solution: Carefully review the Google Play policies and ensure compliance. Address any feedback from the review team and resubmit the app.

Conclusion

Troubleshooting mobile application errors can be challenging, but with the right tools and knowledge, most issues can be resolved efficiently. This document should serve as a starting point for diagnosing and fixing common problems on both iOS and Android platforms. Always keep your tools updated and leverage the developer community for support.